package com.kgcx.organization.service;

import com.kgcx.organization.domain.Auto;
import com.kgcx.organization.domain.Insurance;
import com.kgcx.organization.rabbitmq.producer.InsuranceProducer;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
/**
 * 车辆保险服务
 * @author qinze
 *
 */
@Service
public class InsuranceService {
	@Resource
	private InsuranceProducer insuranceProducer;
	
	public void addCarInsurance (Auto auto) {
		Insurance insurance = new Insurance();
    		insurance.setVehicleNo(auto.getAutoNo());
    		insurance.setInsurCom(auto.getInsurCom());
    		insurance.setInsurNum(auto.getInsurNum());
    		insurance.setInsurType(auto.getInsurType());
    		insurance.setInsurCount(Long.parseLong(String.valueOf(auto.getInsurCount())));
    		insurance.setInsurEff(auto.getInsurEff());
    		insurance.setInsurExp(auto.getInsurExp());
    		insuranceProducer.addInsuranceProducer(insurance);
	}
}
